package lanqiao;

import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();
        int x3 = sc.nextInt();
        int y3 = sc.nextInt();
        int x4 = sc.nextInt();
        int y4 = sc.nextInt();

        long area1 = (x2-x1)*(y2-y1);
        long area2 = (x4-x3)*(y4-y3);
        if (Math.min(x2,x4)>Math.max(x1,x3) &&
                (Math.max(y1,y3)<Math.min(y2,y4))) {
            long area3 = (Math.min(x2,x4)-Math.max(x1,x3))*(Math.min(y2,y4)-Math.max(y1,y3));
            System.out.println(area1+area2-area3);
        } else {
            System.out.println(area1+area2);
        }


    }
}
